{% extends "base.html" %}

{% block title %}
    职员管理
{% endblock %}

{% block head %}
    <h1 class="page-header">职员管理</h1>
{% endblock %}

{% block content %}
    <div class="col-lg-12">
        <div class="row">
            <div class="col-lg-8">
                {% for d in dep_list %}

                    <a class="btn btn-default" href="/person">{{ d.d_name }}</a>

                {% endfor %}


            </div>
            <form role="form" class="col-lg-3" method="get" action="">
                <div class="form-group input-group">
                    <input type="hidden" name="department_id" value="">
                    <input type="text" name="person_username" class="form-control" placeholder="输入要搜索的雇员的名字"
                           value="">
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="submit">
                            <i class="fa fa-search"></i>
                        </button>
                    </span>
                </div>
            </form>
            <div class="col-lg-1">
                <a class="btn btn-default" href="/add_person">添加</a>
            </div>
        </div>
        <div class="row">
            <table class="table">
                <thead>
                <tr>
                    <th>职员用户名</th>
                    <th>职员密码</th>
                    <th>职员昵称</th>
                    <th>职员年龄</th>
                    <th>职员性别</th>
                    {#                    <th>职员照片</th>#}
                    {#                    <th>职员邮箱</th>#}
                    {#                    <th>职员地址</th>#}
                    {#                    <th>职员绩效</th>#}
                    <th>职员部门</th>
                    <th>职员职位</th>

                </tr>
                </thead>
                <tbody>

                {% for n in person_list %}
                    <tr>
                        <td>{{ n.username }}</td>
                        <td>{{ n.password }}</td>
                        <td>{{ n.nickname }}</td>
                        <td>{{ n.age }}</td>
                        <td>{{ n.gender }}</td>
                        {#                    <td>{{ n.photo }}</td>#}
                        {#                    <td>{{ n.email }}</td>#}
                        {#                    <td>{{ n.address }}</td>#}
                        {#                    <td>{{ n.score }}</td>#}
                        <td>{{ n.our_position.p_depart.d_name }}</td>
                        <td>{{ n.our_position.p_name }}</td>
                        <td>
                            <a class="btn btn-default" href="/detail_person/{{ n.id }}">详情</a>
                            <a class="btn btn-default" href="/edit_person/{{ n.id }}">编辑</a>
                            <a class="btn btn-default" href="/del_person/{{ n.id }}">删除</a>
                        </td>
                    </tr>
                {% endfor %}


                </tbody>
                <tfoot>
                <tr>
                    <td colspan="4">
                        <ul class="pagination">
                            {% if person_obj.has_prev %}
                                <li><a href="/person?page={{ person_obj.prev_num }}">上一页</a></li>
                            {% endif %}
                            {% for one in page_list %}
                                <li {% if one == person_obj.page %} class="active" {% endif %}><a
                                        href="/person?page={{ one }}">{{ one }}</a></li>
                            {% endfor %}
                            {% if person_obj.has_next %}
                                <li><a href="/person?page={{ person_obj.next_num }}">下一页</a></li>
                            {% endif %}
                        </ul>
                    </td>
                </tr>
                </tfoot>
            </table>
        </div>
    </div>
{% endblock %}